Skip to content

fix(vapi): add cursor-based pagination to propDefinitions#21135

Merged
michelle0927 merged 5 commits into
PipedreamHQ:masterfrom
favzqn:issue-21085-vapi-cursor-pagination
Jul 1, 2026
Merged

fix(vapi): add cursor-based pagination to propDefinitions#21135
michelle0927 merged 5 commits into
PipedreamHQ:masterfrom
favzqn:issue-21085-vapi-cursor-pagination

Conversation

@favzqn

@favzqn favzqn commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Closes #21085.

The three propDefinitions (phoneNumberId, assistantId, squadId) previously fetched only a single page of results. This adds createdAtLt cursor pagination using the prevContext pattern so accounts with >1000 resources can load more results in the dropdown.

Changes

  • vapi.app.mjs: Each async options() now accepts prevContext, passes createdAtLt as a query param for the next page, and returns { options, context } to support load-more
  • package.json: Version bump 0.3.0 -> 0.3.1

Validation

  • pnpm eslint components/vapi — passes clean
  • node --check — passes
  • node scripts/build-components.mjs components/vapi — passes

Summary by CodeRabbit

  • New Features
    • Added optional “Created At (Less Than)” filtering to assistant, squad, and phone number option pickers.
    • Improved option loading to support pagination-style “load more” via created-at cursors when item counts are large.
  • Bug Fixes
    • Made list action summaries and counts resilient when no results are returned.
  • Chores
    • Bumped versions for related actions, sources, and the package.
    • Updated list actions to consistently provide options plus pagination context for improved downstream handling.

The phoneNumberId, assistantId, and squadId async options previously
fetched only a single page. Add createdAtLt cursor pagination using
the prevContext pattern so accounts with >1000 resources can load more.

Closes PipedreamHQ#21085
@vercel

vercel Bot commented Jun 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
pipedream-docs-redirect-do-not-edit Ignored Ignored Jul 1, 2026 6:54pm

Request Review

@ashwins01 ashwins01 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @favzqn, thank you for you contribution! Since there are changes in the vapi.app.mjs file, the corresponding actions need their versions to be updated for them to be reviewed and tested properly. Can you resolve conflicts and update the package versions and do a round of testing for the list-* actions ?
Sharing our contribution guidelines for your reference: https://pipedream.com/docs/components/contributing/guidelines

Also, since the return shape has changed, the caller sites need to be modified to utilise the changed options return change aswell.

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7c0b192f-ed25-4a69-b71c-76288f2870c3

📥 Commits

Reviewing files that changed from the base of the PR and between 1a1b239 and 6ed61dd.

📒 Files selected for processing (1)
  • components/vapi/vapi.app.mjs

📝 Walkthrough

Walkthrough

Cursor-based createdAtLt pagination is added to assistantId, squadId, and phoneNumberId option loaders in vapi.app.mjs. Three list-option actions now accept and forward createdAtLt, return cursor context, and make $summary null-safe. Several Vapi component and package versions were also bumped.

Changes

Vapi Pagination and Version Updates

Layer / File(s) Summary
Cursor pagination in propDefinitions
components/vapi/vapi.app.mjs
assistantId, squadId, and phoneNumberId options now accept prevContext, conditionally add createdAtLt to request params, and return context.createdAtLt from the last item when the returned page size equals LIMIT.
Option action wiring
components/vapi/actions/list-assistant-id-options/list-assistant-id-options.mjs, components/vapi/actions/list-phone-number-id-options/list-phone-number-id-options.mjs, components/vapi/actions/list-squad-id-options/list-squad-id-options.mjs
Adds optional createdAtLt props, passes them via prevContext to the corresponding options calls, updates descriptions/version where changed, makes $summary tolerant of missing options, and returns { options, context }.
Version bumps
components/vapi/actions/create-call/create-call.mjs, components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs, components/vapi/actions/upload-file/upload-file.mjs, components/vapi/sources/new-conversation/new-conversation.mjs, components/vapi/package.json
Bumps version fields for these components and the package version, without other logic changes.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • PipedreamHQ/pipedream#21084: Directly related; both PRs change the Vapi phoneNumberId, assistantId, and squadId option-loading behavior.
  • PipedreamHQ/pipedream#15469: Related Vapi component work touching the same action/component area and adjacent option-loader code paths.

Suggested labels: ai-assisted

Suggested reviewers: michelle0927

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning Several unrelated action files were version-bumped without functional changes, beyond the pagination work requested by the linked issue. Remove or justify the unrelated version-only bumps in create-call, update-assistant-settings, upload-file, and new-conversation.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding cursor-based pagination to Vapi propDefinitions.
Description check ✅ Passed The PR description includes a summary, changes, and validation, but it omits the template's checklist/versioning sections.
Linked Issues check ✅ Passed The changes implement cursor-based pagination with prevContext for phoneNumberId, assistantId, and squadId, and bump the package version.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
components/vapi/actions/list-phone-number-id-options/list-phone-number-id-options.mjs (1)

23-33: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Same return-shape mismatch as the other list-*-options actions.

vapi.propDefinitions.phoneNumberId.options now returns { options, context } (components/vapi/vapi.app.mjs lines 83-97), but this action treats the whole return value as options. options?.length is always undefined$summary always reports 0, and return options returns the wrapper object instead of the array of { label, value } entries. The context.createdAtLt cursor for "load more" is also lost.

🐛 Proposed fix
-    const options = await vapi.propDefinitions.phoneNumberId.options.call(this.vapi, {
+    const { options, context } = await vapi.propDefinitions.phoneNumberId.options.call(this.vapi, {
       prevContext: {
         createdAtLt: this.createdAtLt,
       },
     });
-    $.export("$summary", `Successfully retrieved ${options?.length ?? 0} option${options?.length === 1
-      ? ""
-      : "s"}`);
+    $.export("$summary", `Successfully retrieved ${options?.length ?? 0} option${options?.length === 1
+      ? ""
+      : "s"}${context?.createdAtLt
+      ? `. Pass createdAtLt="${context.createdAtLt}" to load the next page.`
+      : ""}`);
     return options;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@components/vapi/actions/list-phone-number-id-options/list-phone-number-id-options.mjs`
around lines 23 - 33, The action in list-phone-number-id-options.mjs is treating
vapi.propDefinitions.phoneNumberId.options as the final array, but it now
returns a wrapper object with options and context. Update run() to destructure
the result, use the options array for the $.summary count, return the options
array instead of the wrapper, and preserve the returned context (including
createdAtLt) so the load-more cursor continues to work.
components/vapi/actions/list-squad-id-options/list-squad-id-options.mjs (1)

23-33: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Same return-shape mismatch as the other list-*-options actions.

vapi.propDefinitions.squadId.options now returns { options, context } (components/vapi/vapi.app.mjs lines 53-65), but this action assigns the whole return value to options. options?.length is always undefined$summary always reports 0, and return options returns the wrapper object rather than the array of { label, value } entries. The context.createdAtLt cursor is also lost, so pagination cannot actually be driven from this action.

🐛 Proposed fix
-    const options = await vapi.propDefinitions.squadId.options.call(this.vapi, {
+    const { options, context } = await vapi.propDefinitions.squadId.options.call(this.vapi, {
       prevContext: {
         createdAtLt: this.createdAtLt,
       },
     });
-    $.export("$summary", `Successfully retrieved ${options?.length ?? 0} option${options?.length === 1
-      ? ""
-      : "s"}`);
+    $.export("$summary", `Successfully retrieved ${options?.length ?? 0} option${options?.length === 1
+      ? ""
+      : "s"}${context?.createdAtLt
+      ? `. Pass createdAtLt="${context.createdAtLt}" to load the next page.`
+      : ""}`);
     return options;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@components/vapi/actions/list-squad-id-options/list-squad-id-options.mjs`
around lines 23 - 33, The list-squad-id-options action is handling the new
return shape incorrectly in run(); vapi.propDefinitions.squadId.options now
returns an object with options and context, not the array directly. Update run()
to destructure the response from vapi.propDefinitions.squadId.options, use the
options array for $.export("$summary") and the return value, and propagate the
returned context so the createdAtLt cursor can be preserved for pagination.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@components/vapi/actions/list-assistant-id-options/list-assistant-id-options.mjs`:
- Around line 23-33: The `run` method in `list-assistant-id-options.mjs` is
treating the `vapi.propDefinitions.assistantId.options` result as the options
array, but it now returns a `{ options, context }` wrapper. Destructure the
returned value in `run` so you use the inner `options` array for
`$.export("$summary")` and `return`, and also preserve `context` by exposing the
pagination cursor (for example via an exported output or summary) so downstream
consumers still get the flat `{ label, value }` list and can continue loading
more using `createdAtLt`.

In `@components/vapi/vapi.app.mjs`:
- Around line 12-36: The cursor-based pagination logic is duplicated in the
options methods for assistantId, squadId, and phoneNumberId; extract it into a
shared private helper in vapi.app.mjs. Move the repeated
prevContext?.createdAtLt handling, params.createdAtLt assignment,
listAssistants-style fetch, and context.createdAtLt calculation based on
lastItem?.createdAt and LIMIT into a helper such as _paginatedOptions(fetchFn,
prevContext, mapFn), then have each propDefinition’s options() delegate to it
and keep only the field-specific mapping.

---

Outside diff comments:
In
`@components/vapi/actions/list-phone-number-id-options/list-phone-number-id-options.mjs`:
- Around line 23-33: The action in list-phone-number-id-options.mjs is treating
vapi.propDefinitions.phoneNumberId.options as the final array, but it now
returns a wrapper object with options and context. Update run() to destructure
the result, use the options array for the $.summary count, return the options
array instead of the wrapper, and preserve the returned context (including
createdAtLt) so the load-more cursor continues to work.

In `@components/vapi/actions/list-squad-id-options/list-squad-id-options.mjs`:
- Around line 23-33: The list-squad-id-options action is handling the new return
shape incorrectly in run(); vapi.propDefinitions.squadId.options now returns an
object with options and context, not the array directly. Update run() to
destructure the response from vapi.propDefinitions.squadId.options, use the
options array for $.export("$summary") and the return value, and propagate the
returned context so the createdAtLt cursor can be preserved for pagination.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: dd0d7223-b94e-4196-ae5e-9c75d3215dad

📥 Commits

Reviewing files that changed from the base of the PR and between fcece8b and 8c45f75.

📒 Files selected for processing (9)
  • components/vapi/actions/create-call/create-call.mjs
  • components/vapi/actions/list-assistant-id-options/list-assistant-id-options.mjs
  • components/vapi/actions/list-phone-number-id-options/list-phone-number-id-options.mjs
  • components/vapi/actions/list-squad-id-options/list-squad-id-options.mjs
  • components/vapi/actions/update-assistant-settings/update-assistant-settings.mjs
  • components/vapi/actions/upload-file/upload-file.mjs
  • components/vapi/package.json
  • components/vapi/sources/new-conversation/new-conversation.mjs
  • components/vapi/vapi.app.mjs

Comment thread components/vapi/vapi.app.mjs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@components/vapi/vapi.app.mjs`:
- Around line 63-84: The _paginatedOptions helper in vapi.app.mjs manually
guards params.createdAtLt with an if check, but this optional value should be
passed through directly. Update _paginatedOptions to build the request params
object with createdAtLt assigned from prevContext?.createdAtLt without a
conditional, relying on the axios helper to strip undefined values
automatically; keep the rest of the pagination logic unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: e37eeab5-1a8f-45d8-8336-d473f0661087

📥 Commits

Reviewing files that changed from the base of the PR and between 8c45f75 and 1a1b239.

📒 Files selected for processing (4)
  • components/vapi/actions/list-assistant-id-options/list-assistant-id-options.mjs
  • components/vapi/actions/list-phone-number-id-options/list-phone-number-id-options.mjs
  • components/vapi/actions/list-squad-id-options/list-squad-id-options.mjs
  • components/vapi/vapi.app.mjs

Comment thread components/vapi/vapi.app.mjs
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@michelle0927

Copy link
Copy Markdown
Collaborator

Eval results — claude-haiku-4-5 against the private-registry build of this branch

3/3 pass, all three list-*-id-options actions exercised end-to-end with the new pagination-context shape.

Run: 2026-07-01T19:09:49Z · claude-haiku-4-5-20251001 · 8.7s wall · 37.8k input + 0.6k output tokens · PR head 6ed61dd3e

# Eval Category Targeted tool Calls Time Result
1 List available assistant options read list-assistant-id-options 1 7.2s
2 List available squad options read list-squad-id-options 1 6.2s
3 List available phone number options read list-phone-number-id-options 1 6.8s

Each action returned the new { options, context } shape correctly. Sample evidence from the run:

The other files in the PR (create-call, update-assistant-settings, upload-file, sources/new-conversation) are version-bump-only; the framework's filterToMeaningfulFiles correctly narrowed the eval scope to the three actions with real behavior changes.

@michelle0927 michelle0927 dismissed ashwins01’s stale review July 1, 2026 19:14

dismissing previous review

@michelle0927 michelle0927 merged commit f4963c0 into PipedreamHQ:master Jul 1, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

prioritized Prioritized issue User submitted Submitted by a user

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vapi: add cursor-based pagination to phoneNumberId, assistantId, and squadId propDefinitions

5 participants